package oom;

import java.util.ArrayList;

/**
 * @author K
 * @date 2021-01-10 10:33
 * 演示堆的溢出
 * VM args: -Xms5m -Xmx5m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=f:\dump\heap.hprof -XX:+PrintGCDetails -XX:+PrintGCTimeStamps
 */
public class HeapOom {

    static class OomObject {

    }

    public static void main(String[] args) {
        ArrayList<OomObject> list = new ArrayList<>();
        while (true) {
            list.add(new OomObject());
        }
    }
}
